package com.qb.hotelTV.constants;

/**
 * 应用常量类
 * 统一管理所有常量，避免硬编码
 */
public class AppConstants {
    
    // ========== SharedPreferences Keys ==========
    public static final String PREFS_NAME = "HotelTV";
    public static final String KEY_SERVER_ADDRESS = "server_address";
    public static final String KEY_ROOM_NUMBER = "room_number";
    public static final String KEY_TENANT = "tenant";
    public static final String KEY_IS_FIRST_RUN = "isFirstRun";
    public static final String KEY_CHANNEL_CACHE = "channel_cache";
    public static final String KEY_CHANNEL_CACHE_TIME = "channel_cache_time";
    
    // ========== 网络相关 ==========
    public static final int HTTP_TIMEOUT_CONNECT = 30_000; // 30秒
    public static final int HTTP_TIMEOUT_READ = 30_000;    // 30秒
    public static final int HTTP_TIMEOUT_WRITE = 30_000;   // 30秒
    
    // ========== 缓存相关 ==========
    public static final long CACHE_EXPIRE_TIME_HOUR = 1; // 1小时
    public static final long CACHE_EXPIRE_TIME_DAY = 24;  // 24小时
    
    // ========== 时间相关 ==========
    public static final long SCREEN_SAVER_DELAY = 10_000; // 10秒无操作进入屏保
    public static final long TIME_UPDATE_INTERVAL = 1_000; // 时间更新间隔1秒
    public static final long TV_TEXT_UPDATE_INTERVAL = 5_000; // TV文本更新间隔5秒
    
    // ========== 权限相关 ==========
    public static final int PERMISSION_REQUEST_CODE = 1001;
    public static final String[] REQUIRED_PERMISSIONS = {
            android.Manifest.permission.RECORD_AUDIO,
            android.Manifest.permission.READ_PHONE_STATE,
            android.Manifest.permission.READ_EXTERNAL_STORAGE,
            android.Manifest.permission.WRITE_EXTERNAL_STORAGE
    };
    
    // ========== 百度TV SDK相关 ==========
    public static final String BAIDU_SDK_TAG = "BaiduTvSdk";
    
    // 语音意图常量
    public static final String INTENT_TV_CONTROL_PLAY = "tv.control.play";
    public static final String INTENT_TV_CONTROL_PAUSE = "tv.control.pause";
    public static final String INTENT_TV_CONTROL_STOP = "tv.control.stop";
    public static final String INTENT_TV_CHANNEL_SWITCH = "tv.channel.switch";
    public static final String INTENT_TV_CHANNEL_UP = "tv.channel.up";
    public static final String INTENT_TV_CHANNEL_DOWN = "tv.channel.down";
    public static final String INTENT_TV_CHANNEL_NEXT = "tv.channel.next";
    public static final String INTENT_TV_CHANNEL_PREVIOUS = "tv.channel.previous";
    public static final String INTENT_TV_VOLUME_UP = "tv.control.volume.up";
    public static final String INTENT_TV_VOLUME_DOWN = "tv.control.volume.down";
    public static final String INTENT_TV_VOLUME_MUTE = "tv.control.volume.mute";
    public static final String INTENT_TV_CONTROL_BACK = "tv.control.back";
    public static final String INTENT_TV_CONTROL_HOME = "tv.control.home";
    public static final String INTENT_TV_CONTROL_MENU = "tv.control.menu";
    public static final String INTENT_TV_POWER_OFF = "tv.control.power.off";
    public static final String INTENT_TV_CONTENT_SEARCH = "tv.content.search";
    public static final String INTENT_TV_PROGRAM_QUERY = "tv.program.query";
    
    // ========== 视频播放相关 ==========
    public static final long VIDEO_LOADING_TIMEOUT = 10_000; // 视频加载超时10秒
    public static final int VIDEO_RETRY_COUNT = 3; // 视频重试次数
    
    // ========== TV端配置 ==========
    public static final int TV_DESIGN_WIDTH_DP = 960;
    public static final int TV_DESIGN_HEIGHT_DP = 540;
    public static final float TV_FOCUS_SCALE = 1.1f; // 焦点缩放比例
    
    // ========== 错误码 ==========
    public static final int ERROR_CODE_NETWORK = -1;
    public static final int ERROR_CODE_CONFIG_INCOMPLETE = -2;
    public static final int ERROR_CODE_PERMISSION_DENIED = -3;
    public static final int ERROR_CODE_VIDEO_LOAD_FAILED = -4;
    public static final int ERROR_CODE_VOICE_INIT_FAILED = -5;
    
    // ========== 默认值 ==========
    public static final String DEFAULT_SERVER_ADDRESS = "";
    public static final String DEFAULT_ROOM_NUMBER = "";
    public static final String DEFAULT_TENANT = "";
    public static final String DEFAULT_CHANNEL_NAME = "南宁新闻综合频道";
    
    // ========== 频道相关 ==========
    public static final class ChannelNames {
        public static final String NANNING_PUBLIC = "南宁公共频道";
        public static final String NANNING_NEWS = "南宁新闻综合频道";
        public static final String NANNING_LIFE = "南宁都市生活频道";
        public static final String NANNING_ENTERTAINMENT = "南宁影视娱乐频道";
    }
    
    // ========== 消息相关 ==========
    public static final class Messages {
        public static final String CONFIG_SAVE_SUCCESS = "配置保存成功";
        public static final String CONFIG_INCOMPLETE = "请填写完整的配置信息";
        public static final String CHANNEL_LOAD_SUCCESS = "频道数据加载成功";
        public static final String CHANNEL_LOAD_FAILED = "频道数据加载失败";
        public static final String CHANNEL_REFRESH_SUCCESS = "频道数据刷新成功";
        public static final String CHANNEL_NOT_FOUND = "未找到频道";
        public static final String VOICE_PERMISSION_GRANTED = "语音权限已授权";
        public static final String VOICE_PERMISSION_REQUIRED = "需要语音权限才能使用语音控制功能";
        public static final String VOICE_INIT_SUCCESS = "语音控制初始化成功";
        public static final String VOICE_INIT_FAILED = "语音控制初始化失败";
        public static final String ERROR_PREFIX = "错误: ";
    }
    
    // ========== Fragment标签 ==========
    public static final class FragmentTags {
        public static final String PAGE_AND_LIST_ROW_FRAGMENT = "PageAndListRowFragment";
        public static final String EXO_PLAYER_FRAGMENT = "ExoPlayerFragment";
    }
    
    // ========== Intent额外数据键 ==========
    public static final class IntentExtras {
        public static final String CHANNEL_ID = "channel_id";
        public static final String CHANNEL_NAME = "channel_name";
        public static final String CHANNEL_URL = "channel_url";
        public static final String VIDEO_POSITION = "video_position";
    }
    
    // ========== API相关 ==========
    public static final class ApiConfig {
        public static final String BASE_URL_PREFIX = "http://";
        public static final String HEADER_TENANT_ID = "tenant-id";
        public static final String HEADER_AUTHORIZATION = "Authorization";
        public static final String CONTENT_TYPE_JSON = "application/json";
        public static final String CHARSET_UTF8 = "UTF-8";
    }
    
    // ========== 日志标签 ==========
    public static final class LogTags {
        public static final String MAIN_ACTIVITY = "MainActivity";
        public static final String INDEX_ACTIVITY = "IndexActivity";
        public static final String TV_REPOSITORY = "TvRepository";
        public static final String INDEX_VIEW_MODEL = "IndexViewModel";
        public static final String BOT_INTENT_HANDLER = "BotIntentHandler";
        public static final String THREAD_POOL_MANAGER = "ThreadPoolManager";
        public static final String SAFE_HANDLER = "SafeHandler";
    }
} 